"use strict";
var __spreadArrays = (this && this.__spreadArrays) || function () {
    for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
    for (var r = Array(s), k = 0, i = 0; i < il; i++)
        for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
            r[k] = a[j];
    return r;
};
// 公共方法
(function () {
    var Scroll = /** @class */ (function () {
        /**
         *
         * @param dom 父容器(ul)的id
         * @param _h 子元素li的高度
         * @param interval 3000  滚动间隔时间
         */
        function Scroll(dom, _h, interval) {
            var NodeList = document.getElementById(dom);
            var timer = setTimeout(function () {
                var _field = NodeList.firstElementChild;
                _field.style.marginTop = _h;
                clearTimeout(timer);
            }, 1000);
            setInterval(function () {
                var _field = NodeList.firstElementChild;
                _field.style.marginTop = '0px';
                NodeList.appendChild(_field);
                var _field = NodeList.firstElementChild;
                _field.style.marginTop = _h;
            }, interval);
        }
        return Scroll;
    }());
    function ScRoll(id, distance, time) {
        var Roll = null;
        return Roll || (Roll = new Scroll(id, distance, time));
    }
    var wd = window;
    wd['Scroll'] = ScRoll;
})();
(function () {
    // 移动PC 通用模板
    var General = /** @class */ (function () {
        function General() {
        }
        General.prototype.newspapers = function () {
        };
        return General;
    }());
})();
// 移动模板
(function () {
    var Frames = "*{padding:0;margin:0}html body{width:100%;height:100%}a{text-decoration:none}a:link{color:blue;text-decoration:none}a:hover{color:red;text-decoration:underline}a:active:{color:red}a:visited{color:black;text-decoration:none}.publictemplatestyle{width:98%;height:6.4rem;margin:0.6rem;margin:1%;background-color:rgba(0,0,0,0.2)}h1 h2 h3 h4 h5 h6{margin-left:10px;line-height:0px}img{animation:fade-in;animation-duration:1s;-webkit-animation:fade-in 1.5s}strong{color:white}div>strong{color:white}.overleaf{position:fixed;bottom:5rem;z-index:2147483647!important}.publictemplatestyle>table{width:100%;height:auto;background:rgba(0,0,0,0.5);color:white}.publictemplatestyle>table>tbody>tr{text-align:center;line-height:3rem}.publictemplatestyle>table>tbody>tr:nth-last-child(){}.publictemplatestyle>table>tbody>td{text-align:center}.publictemplatestyle>table>tbody>td:nth-last-child(){}.zuoyoutuwen{background:rgba(0,0,0,0.18);display:flex;display:-webkit-flex;display:inline-flex}.zuoyoutuwen>.let{width:50%;height:100%;display:flex-direction}.zuoyoutuwen>.let>img{width:100%;height:100%}.shoumeges{display:flex;display:-webkit-flex;height:100%}.imgAdvertisementForm>.shoumeges>div{text-align:center;flex-grow:3;height:100%}.shoumeges>div>img{width:100%;height:100%;height:auto;max-width:100%;max-height:100%;animation:animated-border 1s infinite;font-family:Arial;font-size:18px;line-height:30rpx;font-weight:bold;color:#8f8f94;border-radius:10px;animation:fade-in;animation-duration:2s;-webkit-animation:fade-in 1.5s}.titleImges>img{width:100%;height:100%}.MonotonicShut-off{display:flex;display:-webkit-flex;background:rgba(0,0,0,0.18);height:4rem;overflow:hidden}.MonotonicShut-off>div{flex-grow:3;justify-content:space-around}.MonotonicShut-off>div:nth-child(2){width:70%}.MonotonicShut-off>div:nth-child(2)>a>strong{line-height:4rem}.MonotonicShut-off>div:nth-child(3){width:5%}.MonotonicShut-off>div:nth-child(3)>p{line-height:4rem;text-align:center}.description{width:3rem;height:100px;background-color:#aa0000;position:relative}.description:after,.description:before{border:solid transparent;content:\" \";height:0;left:100%;position:absolute;width:0}.description:after{border-left-color:#aa0000;top:-2.5rem}.description:before{border-width:2rem;border-left-color:#aa0000}.description>strong{line-height:4rem;margin-left:1rem;color:white}#close{display:inline-block;width:1.2rem;height:4px;background:#333;transform:rotate(45deg)}#close::after{content:\"\";display:block;width:1.2rem;height:4px;background:#333;transform:rotate(-90deg)}@keyframes fade-in{0%{opacity:0}40%{opacity:0}100%{opacity:1}}@-webkit-keyframes fade-in{0%{opacity:0}40%{opacity:0}100%{opacity:1}}@keyframes animated-border{0%{box-shadow:0 0 0 0 rgba(255,255,255,0.4)}90%{box-shadow:0 0 0 10px rgba(255,255,255,0)}}.slide{margin:auto;width:600px;height:200px;text-align:center;font-family:Arial;color:#fff;overflow:hidden}.slide ul{margin:10px 0;padding:0;width:9999px;transition:all 0.5s}.slide.slide-auto{animation:marginLeft 10.5s infinite}.slide li{float:left;width:600px;height:200px;list-style:none;line-height:200px;font-size:36px}.slide li:nth-child(1){background:#9fa8ef}.slide li:nth-child(2){background:#ef9fb1}.slide li:nth-child(3){background:#9fefc3}@keyframes marginLeft{0%{margin-left:0}28.5%{margin-left:0}33.3%{margin-left:-600px}62%{margin-left:-600px}66.7%{margin-left:-1200px}95.2%{margin-left:-1200px}100%{margin-left:0}}.banner{width:100%;height:9.4rem;overflow:hidden;margin:0 auto}.inner{width:9999px;position:relative;animation:aaa 16s infinite 2s running}@keyframes aaa{0%{transform:translateX(0px)}5%{transform:translateX(-640px)}25%{transform:translateX(-640px)}30%{transform:translateX(-1280px)}50%{transform:translateX(-1280px)}55%{transform:translateX(-1920px)}75%{transform:translateX(-1920px)}80%{transform:translateX(-2560px)}100%{transform:translateX(-2560px)}}.inner:hover{animation-play-state:paused;cursor:pointer}.innerwrapper{float:left;width:640px}.banner img{width:100%;height:300px}.AdvertisingLogo{position:absolute;right:0px;background:#000000;color:white;bottom:0px}#father{position:fixed;top:0;z-index:2147483647!important;width:100%;height:100%;background-color:rgba(0,0,0,0.7);display:flex;justify-content:center;align-items:center}#son{width:50%;height:50%;background-color:green;border-radius:1rem}#son>div{background-size:cover;background-attachment:fixed;background-repeat:no-repeat}.alertbox{width:80%;height:20%;background:rgba(255,255,255,0.95);border-radius:1rem;box-shadow:3px 1px 72px#888888;border:1px solid#007aff}.toptext{width:100%;height:70%;border-bottom:1px solid#007aff;display:flex;justify-content:center;align-items:center}.buottnbt{width:100%;height:30%;border-radius:2rem}.toptext h3{text-align:center}.let{width:49.5%;height:100%;float:left;border-radius:1rem;text-align:center;font-weight:600;display:flex;justify-content:center;align-items:center;color:#007aff}.let:active{background:#4a9bfa;background-color:rgba(0,0,0,0.2)}.rets{border-left:1px solid;border-top-left-radius:0em;border-top-right-radius:0em;border-bottom-right-radius:1em;border-bottom-left-radius:0em}#father{position:fixed;top:0;width:100%;height:100%;background-color:rgba(0,0,0,0.7);display:flex;justify-content:center;align-items:center;z-index:2147483647!important}#son{width:80%;height:90%;background-color:green;border-radius:1rem}#son>div{background-size:cover;background-attachment:fixed;background-repeat:no-repeat}.Mixlocs{position:absolute;right:2.5rem;background-color:rgba(0,0,0,0.2);line-break:normal;top:2rem;letter-spacing:0.5rem;color:#ffffff;padding:0.5rem;border-radius:1rem}.box{position:fixed;top:0;width:100%;height:100vh;margin:0 auto;background-repeat:no-repeat;background-size:cover;overflow:auto;z-index:2147483647!important}._container{overflow:hidden;text-align:center}._container li{width:100%;font-size:18px}._container li:first-child{margin-top:0;transition:margin-top 2s}.bouttBox{width:100%;background-color:#007AFF;height:10rem}.bouttBox ul{width:100%;height:100%}.bouttBox ul>li{width:100%;height:100%}.bouttBox ul>li img{width:100%height:100%}.contter{width:100%;height:100%;display:-webkit-flex;overflow:hidden}.contter>a{width:100%;height:100%}.contter>a>img{width:100%;height:85%;height:auto;max-width:100%;max-height:85%;animation:animated-border 1s infinite;font-family:Arial;font-weight:bold;color:#8f8f94;animation:fade-in;animation-duration:2s;-webkit-animation:fade-in 1.5s}";
    var style = document.createElement('style');
    style.type = 'text/css';
    style.id = 'setstyle';
    style.innerHTML = Frames;
    document.querySelectorAll('head')[0].appendChild(style);
    var CommercialTemplate = /** @class */ (function () {
        function CommercialTemplate(sw) {
            var _this = this;
            if (sw === void 0) { sw = false; }
            setTimeout(function () {
                _this.publicJavaScript(sw);
            }, 500);
        }
        CommercialTemplate.prototype.publicJavaScript = function (autoclos) {
            var num = 5, getDom, Mixlocs;
            // num = 5; // 默认为5秒跳出广告
            Mixlocs = document.getElementsByClassName('Mixlocs')[0];
            if (!Mixlocs)
                return false;
            getDom = Mixlocs.children[0];
            getDom.innerText = num;
            var interval = setInterval(function () {
                num--;
                getDom.innerText = num;
                if (num == 0) {
                    var tg = getDom.parentNode;
                    tg && (tg.innerHTML = '跳过');
                    if (autoclos) {
                        if (Mixlocs.parentNode.id === 'father') {
                            Mixlocs.parentNode.remove();
                            return false;
                        }
                        Mixlocs.parentNode.parentNode.remove();
                    }
                    if (tg.innerHTML === '跳过') {
                        tg.onclick = function () {
                            this.parentNode.remove();
                            return false;
                        };
                    }
                    clearInterval(interval);
                }
            }, 1000);
        };
        /**
         * 判断当前的是否是数组，否是就停止后面程序
         * @param ArrAy 数组
         */
        CommercialTemplate.prototype.isArray = function (arratobj) {
            if (!Array.isArray(arratobj)) {
                return false;
            }
        };
        /**
         * 延时执行函数
         * @param fun 需要延时的函数 string
         * @param time 需要延时的时间 number
         */
        CommercialTemplate.prototype.delayed = function (fun, time) {
            setTimeout(function () { eval(fun); }, time);
        };
        /**
         * 公共样式
         * @param e 样式key值
         * @param img 所需要的图片
         */
        CommercialTemplate.prototype.common = function (e, img) {
            var communalFacilities = {
                w_h100: "width: 100%;height: 100%;",
                backgImage: "background-image:url(" + img,
                color: "color: #007aff"
            };
            return communalFacilities[e];
        };
        /**
         *
         * @param e 公共html模板key值
         */
        CommercialTemplate.prototype.templateMobile = function (e) {
            var template = {
                signboard: "<div class=\"AdvertisingLogo\" style='z-index: 2147483647!important;' >\u5E7F\u544A</div>",
                wait: " <div class=\"Mixlocs\">\u5E7F\u544A<span>3</span></div>",
                shut_off: "\t<p><span id=\"close\"></span></p>"
            };
            return template[e];
        };
        /**
         *
         * @param src 全屏广告
         */
        CommercialTemplate.prototype.fullScreen = function (img, src) {
            return "<a href=\"" + src + "\"><div class=\"box\" style=\"" + this.common('backgImage', img) + ");\">\n        " + this.templateMobile('wait') + "\n        " + this.templateMobile('signboard') + "\n        </div></a>";
        };
        /**
         *
         * @param src 全屏中间位置位置
         */
        CommercialTemplate.prototype.middlePosition = function (img, src) {
            return "<a href=\"" + src + "\">\t<div id=\"father\">\n            " + this.templateMobile('wait') + "\n            <div id=\"son\">\n                <div style=\"" + this.common('w_h100') + this.common('backgImage', img) + ");border-radius: 1rem;\"></div>\n                " + this.templateMobile('signboard') + "\n            </div>\n        </div></a>";
        };
        /**
         * 弹出框
         * @param obj object
         *
         * title 显示的广告标题
         * confirm 确定按钮
         * cance 取消按钮
         * src 广告路径
         */
        CommercialTemplate.prototype.confirmCentre = function (title, src, confirm, cance, yes, Noclos) {
            setTimeout(function () {
                var mm = document.getElementsByClassName('buottnbt')[0].children;
                mm[0].onclick = function () {
                    if (yes) {
                        eval("(" + yes + ")()");
                    }
                    else {
                        window.location.href = src;
                    }
                    console.log('确定');
                    // window.location.href = src;
                };
                mm[1].onclick = function () {
                    console.log();
                    if (Noclos) {
                        eval("(" + Noclos + ")()");
                    }
                    document.getElementById('father') && document.getElementById('father').remove();
                };
            }, 500);
            var hh3 = "<h3>" + title + "</h3>";
            var img = "<img src=\"" + title + "\" style='border-radius: 1rem 1rem 0 0;" + this.common('w_h100') + "'>";
            return "<div id=\"father\">\n           " + this.templateMobile('wait') + "\n            <div class=\"alertbox\">\n                <div class=\"toptext\">\n                <a href=\"" + src + "\" style='" + this.common('w_h100') + "'>\n                " + (title.startsWith('https://') ? img : title.startsWith('http://') ? img : hh3) + "</a>\n                </div>\n                <div class=\"buottnbt\">\n                    <div class=\"let\">\n                        <strong style='" + this.common('color') + "'>" + (!confirm ? '确定' : confirm) + "</strong>\n                    </div>\n                    <div class=\"rets let\">\n                        <strong style='" + this.common('color') + "'>" + (!cance ? '取消' : cance) + "</strong>\n                    </div>\n                </div>\n            </div>\n            " + this.templateMobile('signboard') + "\n        </div>";
        };
        /**
         * 底部多张图片
         * @param img 广告图片
         * @param src Array 广告路径
         */
        CommercialTemplate.prototype.downtitleImges = function (title, src, arrimg) {
            var tp = '';
            var ImgtPath = arrimg.split(',');
            if (ImgtPath.length == 1) {
                tp = "<div>\n                <img alt=\"\u7A7F\u804C\u4E1A\u88C5\u626E\u7684\u5C24\u91CC\u9171\uFF0C\u8BA9\u4EBA\u773C\u524D\u4E00\u4EAE\uFF0C\u66F4\u6709\u5973\u4EBA\u5473\u4E86\" class=\"lazy\" data-original=\"http://upcdn.sdkv.top/250x250/aHR0cHM6Ly95LnZpcDk5Lnh5ei93cC1jb250ZW50L3VwbG9hZHMvc2hpcGluLzAwMDBfMDBfMDAvMWhzZzRoYXNyZHkubXA0LjBfMC5wMC5qcGc=\"\n                 src=\"" + arrimg + "\"\n                 style=\"display: inline;\">\n            </div>";
            }
            else if (ImgtPath.length > 1) {
                ImgtPath.forEach(function (item) {
                    console.log(item);
                    tp += "<div>\n                    <img alt=\"\u7A7F\u804C\u4E1A\u88C5\u626E\u7684\u5C24\u91CC\u9171\uFF0C\u8BA9\u4EBA\u773C\u524D\u4E00\u4EAE\uFF0C\u66F4\u6709\u5973\u4EBA\u5473\u4E86\" class=\"lazy\" data-original=\"http://upcdn.sdkv.top/250x250/aHR0cHM6Ly95LnZpcDk5Lnh5ei93cC1jb250ZW50L3VwbG9hZHMvc2hpcGluLzAwMDBfMDBfMDAvMWhzZzRoYXNyZHkubXA0LjBfMC5wMC5qcGc=\"\n                     src=\"" + item + "\"\n                     style=\"display: inline;\">\n                </div>";
                });
            }
            return "<div class=\"imgAdvertisementForm publictemplatestyle overleaf\">\n            <a href='" + src + "'><strong>" + title + "</strong></a>\n            <div class=\"shoumeges \">\n               " + tp + "\n            </div>\n            " + this.templateMobile('signboard') + "\n        </div>";
        };
        /**
         * 左边图片右边文字
         * @param img 广告图片
         * @param src 广告路径
         * @param title 广告标题
         */
        CommercialTemplate.prototype.downmaster = function (img, src, title) {
            return "<div class=\"zuoyoutuwen publictemplatestyle overleaf\">\n            <div class=\"let\">\n                <img src=\"" + img + "\">\n            </div>\n            <div class=\"relt let\">\n                <strong><a href=\"" + src + "\">" + title + "</a></strong>\n            </div>\n            " + this.templateMobile('signboard') + "\n        </div>";
        };
        // 下左右新闻
        /**
         *
         * @param lettitle string length in min 3
         * @param newLst Array object {src:'',txt}
         * @param time 间隔时间 默认为3000
         */
        CommercialTemplate.prototype.dowjournalism = function (lettitle, newLst, time) {
            if (time === void 0) { time = 3000; }
            this.isArray(newLst);
            this.delayed("Scroll('scroll', '-4rem', " + time + ")", 200);
            // 只能传入 数组对象
            var tp = '';
            if (newLst instanceof Array) {
                __spreadArrays(newLst).forEach(function (element) {
                    tp += "<li><a href=\"" + element.src + "\" style='margin-left: 2rem;color: white;'> <strong>" + element.txt + "</strong></a></li>";
                });
            }
            return "<div class=\"publictemplatestyle MonotonicShut-off overleaf\">\n\t\t\t<div class=\"description\">\n\t\t\t\t<strong>" + (lettitle.length >= 3 ? lettitle.substring(0, 3) : lettitle) + "</strong>\n\t\t\t</div>\n\t\t\t<div>\n\t\t\t\t <ul style=\"width:80%;height:4rem;overflow:hidden;line-height:4rem;\" id=\"scroll\"> \n                        " + tp + "\n\t\t\t\t</ul> \n\t\t\t</div>\n\t\t\t<div>\n                " + this.templateMobile('shut_off') + "\n\t\t\t</div>\n\t\t\t " + this.templateMobile('signboard') + "\n\t\t</div>";
        };
        /**
         * 图片文字描述向上滚动
         * @param obj  ArrAy object {src：‘点击后的链接’，txt：‘显示的文字’,img:'显示的图片'}
         */
        CommercialTemplate.prototype.shufflingthe = function (obj, time) {
            this.isArray(obj);
            this.delayed("Scroll('Imgse_Fuck', '-10rem', " + time + ")", 200);
            var tp = '';
            __spreadArrays(obj).forEach(function (e) {
                tp += " <li>\n                <div class=\"contter\">\n                    <a href=\"" + e.src + "\">\n                        <strong>" + e.txt + "</strong>\n                        <img src=\"" + e.img + "\" alt=\"\">\n\n                    </a>\n                </div>\n            </li>";
            });
            return "\n        <div class=\"bouttBox\">\n            <ul class=\"_container\" id=\"Imgse_Fuck\">\n            " + tp + "\n        </ul>\n\t\t</div>\n        \n        ";
        };
        return CommercialTemplate;
    }());
    function FormalTemplate(of, type) {
        var _a;
        if (of === void 0) { of = false; }
        var prpy = [];
        for (var _i = 2; _i < arguments.length; _i++) {
            prpy[_i - 2] = arguments[_i];
        }
        var exist = null;
        return exist || (exist = (_a = new CommercialTemplate(of))[type].apply(_a, prpy));
    }
    var wd = window;
    wd['FormalTemplate'] = FormalTemplate;
})();
// PC模板
(function () {
})();
